package cn.iocoder.yudao.module.study.accessLimit.config;

import cn.iocoder.yudao.module.study.accessLimit.interceptor.AccessLimitInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @Author cjc
 * @Date 2024/3/20 17:51
 * @Description: 注入拦截器
 * @Version 1.0
 */
@Configuration
public class AccessLimitConfiguration implements WebMvcConfigurer {

    @Bean
    public AccessLimitInterceptor createAccessLimitInterceptor(){
        return new AccessLimitInterceptor();
    }

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(createAccessLimitInterceptor())
                .addPathPatterns("/**");
    }
}
